import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    uname: (window.localStorage.getItem('uname') || null),
  
  },
  mutations: {
    updateuname(state, payload) {
      // 将payload转化为对象后再存储
      // state.uname = JSON.parse()
      state.uname = payload
      // state.password=payload.password
      
      // 将payload存储到 本地，先设置
      localStorage.setItem('uname',payload)
    }
  },
  actions: {
  },
  modules: {
  }
})
